<html xmlns:v="urn:schemas-microsoft-com:vml"
	xmlns:o="urn:schemas-microsoft-com:office:office"
	xmlns:x="urn:schemas-microsoft-com:office:excel"
	xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
	xmlns="http://www.w3.org/TR/REC-html40"
	xmlns:th="http://www.thymeleaf.org">
<head>
<meta name="Excel Workbook Frameset" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="ProgId" content="Excel.Sheet" />
<meta name="Generator" content="WPS Office ET" />
<!--[if gte mso 9]>
   <xml>
    <o:DocumentProperties>
     <o:Author>王沛</o:Author>
     <o:Created>2018-09-22T19:42:47</o:Created>
     <o:LastAuthor> 信仰正能量</o:LastAuthor>
     <o:LastSaved>2018-09-22T19:45:23</o:LastSaved>
    </o:DocumentProperties>
    <o:CustomDocumentProperties>
     <o:KSOProductBuildVer dt:dt="string">2052-10.1.0.7521</o:KSOProductBuildVer>
    </o:CustomDocumentProperties>
   </xml>
  <![endif]-->
<link rel="File-List" href="student.files/filelist.xml"
	th:href="@{/student.files/filelist.xml}" />
<link id="shLink" href="student.files/sheet001.htm"
	th:href="@{/student.files/sheet001.htm}" />
<script src="student.files\js.js" th:src="@{/student.files/js.js}"></script>
<!--[if gte mso 9]>
   <xml>
    <x:ExcelWorkbook>
     <x:ExcelWorksheets>
      <x:ExcelWorksheet>
       <x:Name>Sheet1</x:Name>
       <x:WorksheetSource HRef="/student.files/sheet001.html"/>
      </x:ExcelWorksheet>
     </x:ExcelWorksheets>
     <x:Stylesheet HRef="/student.files/stylesheet.css"/>
     <x:ProtectStructure>False</x:ProtectStructure>
     <x:ProtectWindows>False</x:ProtectWindows>
     <x:WindowHeight>8370</x:WindowHeight>
     <x:WindowWidth>20385</x:WindowWidth>
    </x:ExcelWorkbook>
   </xml>
  <![endif]-->

<script language="JavaScript">
	window.onload = function() {

		var btn1 = document.getElementById("ceshi");

		var frame1 = document.getElementById("frSheet");

		//alert("1111");  //OK

		var name = "[[${student.name}]]";
		var age = "[[${student.age}]]";

		frame1.contentWindow.document.getElementById("student_name").value = name;
		frame1.contentWindow.document.getElementById("student_age").value = age;

		btn1.onclick = function() {

			frame1.focus();
	//		if (!frame1.contentWindow.ActiveXObject
	//			|| "ActiveXObject" in frame1.contentWindow) {
	//		remove_ie_header_and_footer();
	//		}
			frame1.contentWindow.print();
		};

		//这段代码本来是用于去除打印时的页眉和页脚的，经过测试发现完全没用
		//解决方案，浏览器上面设置，取消页眉页脚就可以了！就是这么狗血坑爹
	//	function remove_ie_header_and_footer() {
	//		var hkey_root, hkey_path, hkey_key;
	//		hkey_path = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
	//		try {
	//			var RegWsh = new ActiveXObject("WScript.Shell");
	//			hkey_HEADER = "header";
	//			RegWsh.RegWrite(hkey_path + hkey_HEADER, "");
	//			hkey_FOOTER = "footer";
	//			RegWsh.RegWrite(hkey_path + hkey_FOOTER, "");
	//		} catch (e) {
	//		}
	//	}
	};
</script>
</head>
<body>
	<input type="button" id="ceshi" value="测试打印" />
	<br />
	<iframe src="student.files/sheet001.htm" name="frSheet" id="frSheet"
		noresize th:src="@{student.files/sheet001.htm}" frameborder="no" />

</body>
</html>
